﻿#region Creditos

/* Autor: Edilberto Sánchez Forero	*/
/* Email: esanchezfo@gmail.com		*/
/* Licencia: LGPL, Software Libre	*/
/* País: Colombia, Bogotá			*/

#endregion

#region Librerias

using System;
using System.Collections.Specialized;
using System.Runtime.Serialization;

#endregion


namespace ESF.General
{
	[Serializable]
	public class GenericInfoException : GenericException 
	{
		#region Constructores
		
		protected GenericInfoException (SerializationInfo info, StreamingContext context) : base(info, context) { }


		public GenericInfoException (string pMessage) : 
			this (GenericException.INFO_GENERAL, pMessage) {}


		public GenericInfoException(string pMessage, Exception pInnerException) : 
			this (GenericException.INFO_GENERAL, pMessage, pInnerException) {}

			
		public GenericInfoException (string pstrCode, string pstrMessage) 
			: base (AdjustCode (pstrCode), pstrMessage) {}

			
		public GenericInfoException (string pstrCode, string pstrMessage, Exception pexcInnerException) : 
			base (AdjustCode (pstrCode), pstrMessage, pexcInnerException) {}
		
		#endregion
		
		
		#region Funciones
		
		public static string AdjustCode (string pCode)
		{
			if (!pCode.StartsWith (GenericException.PREFIX_INFORMATIVE_ERROR))
			{
				return GenericException.PREFIX_INFORMATIVE_ERROR + pCode;
			}
			
			return pCode;
		}
		
		#endregion		


		#region Methods

		public override string ToString()
		{
			return GenericException.ToString (this);
		}

		#endregion
	}
}
